import { Component } from 'react';
import WithRouter from '../../router/WithRouter';
import bus from '../../utils/bus';
class Info extends Component {
    state = {
        info: null
    }
    render() {
        return (
            <div>
                {this.state.info && <div>
                    <img src={this.state.info.room_thumb} alt="" />
                    <p>{this.state.info.room_name}</p>
                </div>}
            </div>
        )
    }
    componentDidMount() {
        // 获取当前房间id
        let { id } = this.props.router.params;
        console.log(id)
        // 发送请求获取详情数据
        this.$axios.get(`/douyu/api/RoomApi/room/${id}`).then(res => {
            console.log(res)
            this.setState({ info: res.data.data })
            bus.emit("sendTitle",res.data.data.owner_name)
        })
    }
}
export default WithRouter(Info)